---
sidebar_label: Observability Options
sidebar_position: 24
description: Manage observability options with the Hasura metadata API
keywords:
  - hasura
  - docs
  - metadata API
  - API reference
  - observability options
  - opentelemetry
  - open telemetry
  - traces
  - tracing
  - metrics config
  - metrics
  - monitoring
  - enterprise
  - ee
---

import ProductBadge from '@site/src/components/ProductBadge';

# Metadata API Reference: Observability Options

<ProductBadge ce free pro ee self />

## Introduction

The API to manage `Observability` related metadata configurations.

## Logs and metrics configuration

<ProductBadge pro />

These are the configurations that govern the metrics and logging output for debugging and analytics.

## set_metrics_config {#metadata-set-metrics-config}

`set_metrics_config` is used to add/update logs and metrics configurations.

```http
POST /v1/metadata HTTP/1.1
Content-Type: application/json
X-Hasura-Role: admin
{
    "type": "set_metrics_config",
    "args": {
        "analyze_query_variables": false,
        "analyze_response_body": false
    }
}
```

### Args syntax {#set-metrics-config-syntax}

| Key                     | Required | Schema  | Description                                                                                         |
| ----------------------- | -------- | ------- | --------------------------------------------------------------------------------------------------- |
| analyze_query_variables | true     | boolean | Enables logging of the values of the query variables provided for each request. Default is `false`. |
| analyze_response_body   | true     | boolean | Enables logging of the values of the response body for each request. Default is `false`.            |

Please see the corresponding
[feature documentation for the usage of these configurations](/observability/cloud-monitoring/operations.mdx#capture-query-variables).

## remove_metrics_config {#metadata-remove-metrics-config}

`remove_metrics_config` is used to remove all metrics configurations.

```http
POST /v1/metadata HTTP/1.1
Content-Type: application/json
X-Hasura-Role: admin
{
    "type": "remove_metrics_config",
    "args": {}
}
```

## OpenTelemetry Configuration

<ProductBadge self />

The OpenTelemetry configuration enables export of [distributed traces](/observability/cloud-monitoring/tracing.mdx) and
[metrics](/observability/enterprise-edition/prometheus/metrics.mdx) to an to an
[OpenTelemetry](https://opentelemetry.io/) compliant APM receiver.

## set_opentelemetry_config {#metadata-set-opentelemetry-config}

`set_opentelemetry_config` is used to add/update OpenTelemetry configuration.

:::info Supported from

OpenTelemetry traces are supported for Hasura GraphQL Engine versions `v2.18.0` and above.

:::

```http
POST /v1/metadata HTTP/1.1
Content-Type: application/json
X-Hasura-Role: admin
{
    "type": "set_opentelemetry_config",
    "args": {
        "status": "enabled",
        "data_types": [
            "traces",
            "metrics",
            "logs"
        ],
        "exporter_otlp": {
            "otlp_traces_endpoint": "http://localhost:4318/v1/traces",
            "otlp_metrics_endpoint": "http://localhost:4318/v1/metrics",
            "otlp_logs_endpoint": "http://localhost:4318/v1/logs",
            "protocol": "http/protobuf",
            "traces_propagators": ["tracecontext"],
            "headers": [
                {
                    "name": "x-test-header",
                    "value": "testing"
                },
                {
                    "name": "x-header-from-env",
                    "value_from_env": "TEST_ENV_VAR"
                }
            ],
            "resource_attributes": [
                {
                    "name": "stage",
                    "value": "production"
                },
                {
                    "name": "region",
                    "value": "us-east"
                }
            ]
        },
        "batch_span_processor": {
            "max_export_batch_size": 100
        }
    }
}
```

### Args syntax {#set-opentelemetry-config-syntax}

| Key                  | Required | Schema                                                                                             | Description                                                                                                                                                                            |
| -------------------- | -------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| status               | false    | `String`                                                                                           | Toggle to enable or disable the export. Allowed values are `enabled` and `disabled`. Default is `disabled` (If status is not explicitely passed, then the configuration gets disabled) |
| data_types           | false    | `[String]`                                                                                         | List of the types of observability data points to be exported. Allowed types: `traces`, `metrics` and `logs` only                                                                      |
| exporter_otlp        | false    | [OTLPExporter](/api-reference/syntax-defs.mdx#otlpexporter). This is required if status is enabled | OpenTelemetry compliant receiver configuration                                                                                                                                         |
| batch_span_processor | false    | [OpenTelemetryBatchSpanProcessor](/api-reference/syntax-defs.mdx#opentelemetrybatchspanprocessor)  | OpenTelemetry batch export configuration                                                                                                                                               |

## set_opentelemetry_status {#set-opentelemetry-status}

`set_opentelemetry_status` is used to set just the `status` field of the OpenTelemetry configuration, which
enable/disable the export to the OpenTelemetry receiver. Other configuration settings are preserved.

:::info Supported from

This is supported for versions `v2.18.0` and above.

:::

```http
POST /v1/metadata HTTP/1.1
Content-Type: application/json
X-Hasura-Role: admin
{
    "type": "set_opentelemetry_status",
    "args": "enabled"
}
```

Allowed values of `args` are `enabled` and `disabled`
